//
// Created by myrica on 3/26/25.
//

#ifndef MOVEALLOCA_H
#define MOVEALLOCA_H

#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"

#include "mlir/IR/BuiltinOps.h"
#include "mlir/Pass/Pass.h"

namespace irispass {
    std::unique_ptr<mlir::Pass> createMoveAllocaToEntryPass();

    struct MoveAllocaToEntryPass : public mlir::PassWrapper<MoveAllocaToEntryPass, mlir::OperationPass<
                mlir::func::FuncOp> > {
        mlir::StringRef getArgument() const final { return "move-alloca-to-entry"; }

        mlir::StringRef getDescription() const final {
            return "Move all alloca operations to the function entry block";
        }

        void runOnOperation() override;
    };
}

#endif //MOVEALLOCA_H
